package com.qdu.springboot01cache.controller;

import com.qdu.springboot01cache.bean.Department;
import com.qdu.springboot01cache.service.DepartmentService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/department")
public class DepartmentController {

    @Autowired
    private DepartmentService departmentService;

    //根据部门id查询部门
    @RequestMapping("/selectById")
    public Department selectById(Integer id){
        return departmentService.selectByPrimaryKey(id);
    }

    //查询所有部门信息
    @RequestMapping("/selectAll")
    public List<Department> selectAll(){
        return departmentService.selectAll();
    }

}
